package data.connector

import domain.Domain.Access
import org.apache.flink.api.scala._
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment

object BasicConnector {
    def main(args: Array[String]): Unit = {
        val env = StreamExecutionEnvironment.getExecutionEnvironment
        //val env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI()
        env.socketTextStream("hadoop000", 9527).map(x=>{
            val l = x.split(",")
            Access(l(0), l(1))
        }).keyBy(_.key).map(x=>{
            (x.key, x.value, 1)
        }).print()

        env.execute(getClass.getSimpleName)
    }
}
